﻿using System.Globalization;
using System.Threading;
using System.Windows;
using InseSoft.Infraestructure;
using InseSoft.ViewModels;
using InseSoft.Views;
using Ninject;

namespace InseSoft
{
    public partial class App
    {
        private void OnStartup(object sender, StartupEventArgs e)
        {
            var kernel = DIFactory.Kernel = new StandardKernel(new MyNinjectModule());
            ConfigureCulture();

            var view = new MainWindow();
            var viewModel = kernel.Get<MainViewModel>(); 
            view.DataContext = viewModel;
            view.Show();
        }

        private static void ConfigureCulture()
        {
            var newCultureInfo = new CultureInfo("en-US")
            {
                DateTimeFormat = new CultureInfo("es-CR").DateTimeFormat
            };
            Thread.CurrentThread.CurrentCulture = newCultureInfo;
            Thread.CurrentThread.CurrentUICulture = newCultureInfo;
        }
    }
}
